package com.asia5b.a5mall.middleware.model.member

import androidx.databinding.ObservableBoolean
import com.asia5b.a5mall.middleware.model.base.BaseModel
import com.asia5b.a5mall.middleware.model.shop.AbsGoodsModel
import java.io.Serializable

/**
 * 足迹
 */
class FootModel : BaseModel() {
    fun notifyCheck() {
        var checkedSum = 0
        history?.forEach {
            if (it.absGoodsCheckedOb.get()) {
                checkedSum++
            }
        }
        if (checkedSum == 0) {
            checkOB.set(false)
        } else {
            checkOB.set(checkedSum == (history?.size ?: 0))
        }
    }

    var time = 0L
    var checkOB = ObservableBoolean(false)
    var history: ArrayList<AbsGoodsModel>? = null

}

/*
{
"time": 1579190400,
"history": [
    {
        "id": 658,
        "goods_id": 8490,
        "goods_name": "库存第二十五次测试",
        "goods_price": 20,
        "goods_price_list": {
            "price_rmb": 20,
            "price_myr": 11.84,
            "price_thb": 85.72,
            "price_idr": 39876.08,
            "price_vnd": 65939.06,
            "price_php": 143.47
        },
        "goods_img": "http:\/\/47.88.173.86:82\/testShopImg\/20200110\/CD2463DE76F9460892CF1AF4BECE2B0E.jpeg",
        "member_id": 169,
        "member_name": "m_15889636926",
        "create_time": 1579225803,
        "update_time": 1579190400
    }
]
}
 */
